package com.itheima.hashtable;

import java.util.HashMap;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class Demo02 {

    public static void main(String[] args) throws ExecutionException, InterruptedException {
        HashMap<String, String> map = new HashMap<>();

        Thread t1 = new Thread(() -> {
            for (int i = 0; i < 1000; i++) {
                map.put(i + "", i + "");
            }


        });
        Thread t2 = new Thread(() -> {
            for (int i = 1000; i < 2000; i++) {
                map.put(i + "", i + "");
            }

        });
        t1.start();
        t2.start();

       Thread.sleep(2000);
        for (int i = 0; i < 2000; i++) {
            System.out.println(map.get(i+""));
        }
    }
}
